#include <cstdio>  // 包含 printf 函数的定义
namespace PORTING_VAR_EFFECTS {
	
	namespace bad {
		void foo(int m) { printf("Foo called with %d\n", m); }
		void bar(int m) { printf("Bar called with %d\b", m); }
		void laab()
		{
			int m = 0;
			void (*fp[3])(int);
			fp[0] = foo;
			fp[1] = bar;
			(*fp[++m])(++m);
		}
	}

	namespace good {
		void foo(int m) { printf("Foo called with %d\n", m); }
		void bar(int m) { printf("Bar called with %d\b", m); }
		void laab(int fn)
		{
			int m = 0;
			void (*fp[3])(int);
			fp[0] = foo;
			fp[1] = bar;
			(*fp[fn])(++m);
		}
	}
}